
/**
 * Metal
 * @version 1.0
 * @since 1.0
 * <p>
 * Created by Murphy at 2021/7/15 9:13
 **/
#include "Metal.hpp"
#include "usage/Hittable.hpp"
bool Stitches::Metal::scatter(const Stitches::Ray &r_in, const Stitches::HitRecord &rec, Stitches::Vec3f &attenuation,
                              Stitches::Ray &scattered) const
{
    Vec3f reflected = reflect(glm::normalize(r_in.direction()), rec.normal);
    scattered = Ray(rec.p, reflected + randomInUnitSphere() * (float)fuzz);
    attenuation = albedo;
    return (dot(scattered.direction(), rec.normal) > 0);
}
